var playScene_layerUI = cc.Layer.extend({
	_winSize:null,
    sprite_bg:null,
    sprite_mapFrame:null,
    sprite_mapMask:null,
    map_test:null,
    map_test_size:null,
    ctor:function () {
        this._super();
        this._winSize = cc.winSize;

        //背景
        this.sprite_bg = new cc.Sprite(res.bg1_jpg);

        this.sprite_bg.attr({
            x: this._winSize.width / 2,
            y: this._winSize.height / 2,
            scale:1
        });
        this.addChild(this.sprite_bg, 0);

        //地图框
        this.sprite_mapFrame = new cc.Sprite(res.mapFrame_png);
        this.sprite_mapFrame.attr({
            x: this._winSize.width / 2,
            y: this.sprite_mapFrame.height / 2 + 50,
            scale:1
        });
        this.addChild(this.sprite_mapFrame, 2);
		
        //地图遮罩
        this.sprite_mapMask = this.clipper();
        this.sprite_mapMask.attr({
            x: this._winSize.width / 2,
            y: this.sprite_mapMask.height / 2 + 50,
            scale:1
        });
        
        //地图
    	//cc.spriteFrameCache.addSpriteFrames(res.background_plist);
		//this.spriteSheet = cc.SpriteBatchNode.create(res.background_png);
		//this.addChild(this.spriteSheet);
		//this.map_test_size = {
		    //w:this.map_test.getContentSize().width,
		    //w:this.map_test.getContentSize().height
		//}
		//this.setMapObjects(this.map_test, 0);
		this.map_test = new cc.TMXTiledMap(res.testMap_tmx);
        this.map_test.attr({
            x:0 - this.sprite_mapMask.width / 2,
            y:0 - this.sprite_mapMask.height / 2,
            scale:1
        });
        
        this.sprite_mapMask.addChild(this.map_test,0);
        this.addChild(this.sprite_mapMask, 1);
        
        return true;
    },
	clipper : function(){
		//创建以标题作为大小的模板,超出标题部分都会被裁掉
		var maskPNG = new cc.Sprite(res.mapMask_png);

		var clipper = cc.ClippingNode.create();
			clipper.setStencil(maskPNG);
			clipper.setAlphaThreshold(0);
			clipper.setContentSize(
				cc.size(
					maskPNG.getContentSize().width,
					maskPNG.getContentSize().height
				)
			);
		return clipper;
	},
	showDIV:function(){
		indexShowDiv();
	}
});